import request from '@/utils/request'

export function createApi(postData) {
  return request({
    url: '/resources',
    method: 'post',
    data: postData,
  })
}
export function deleteByIdApi(id) {
  return request({
    url: `/resources/${id}`,
    method: 'delete',
  })
}

export function modifyByIdApi(id, data) {
  return request({
    url: `/resources/${id}`,
    method: 'put',
    data: data,
  })
}

export function modifyStatusByIdApi(id) {
  return request({
    url: `/resources/status/${id}`,
    method: 'put',
  })
}

export function getPageApi(queryOption) {
  return request({
    url: '/resources',
    method: 'get',
    params: queryOption,
  })
}

export function getCatalogApi(queryOption) {
  return request({
    url: '/resources/catalog',
    method: 'get',
    params: queryOption,
  })
}

// 获取资源树
export function getResourcesTreeApi(queryOption) {
  return request({
    url: '/resources/tree',
    method: 'get',
    params: queryOption,
  })
}
